﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Model.Repositories;
using Domain.Model.Infracciones;
using Domain.Model.Base;

namespace Infrastructure.Base.InMemory
{

    public class MInfraccionRepository : InfraccionRepository
    {
        private Dictionary<InfraccionId, Infraccion> lista;

        public MInfraccionRepository()
        {
            this.lista = new Dictionary<InfraccionId, Infraccion>();

        }


        public override void Insert(Infraccion entity)
        {
            this.lista.Add((InfraccionId)entity.Identity, entity);
        }

        public override Infraccion FromId(ObjectIdentity id)
        {
            return this.lista[(InfraccionId)id];
        }

        public override ObjectIdentity NextIdentity()
        {
            return new InfraccionId(Guid.NewGuid().ToString().ToUpper());
        }

        public override void Update(Infraccion entity)
        {
            throw new NotImplementedException();
        }

        public override void Remove(ObjectIdentity id)
        {
            this.lista.Remove((InfraccionId)id);
        }

        public override List<Infraccion> All()
        {
            return new List<Infraccion>(this.lista.Values);
        }

        public override int Count()
        {
            return this.lista.Values.Count;
        }

    }
}
